; Copyright (c) 2006, Michael Borgmann
; This code is released under the new BSD license


; Just a small testing kernel for the boot loader
; Build kernel: % nasm smallkernel.asm
; For more information view at bootloader.asm


start:
        mov     ax, 0x1000      ; update segment register
        mov     ds, ax
        mov     es, ax

        mov     si, welcome     ; print welcome message
        call    print

        mov     si, quit        ; print reboot bessage
        call    print

; wait for keypress
keypress:
        mov     ah, 0
        int     0x16

reboot:
        db      0xea
        dw      0x0000
        dw      0xffff

; string output
print:
        lodsb
        or      al, al
        jz      short finished  ; if 0-byte then quit
        
        mov     ah, 0x0e        ; print al
        mov     bx, 7
        int     0x10

        jmp     print           ; write next byte

finished:
        retn

        welcome db "Small Kernel", 13, 10, 0
        quit    db "Press any key to reboot ... ", 10, 0
